All Questions
24 questions
0votes
1answer
808views
How to echo the value of an array element using a function via a shortcode
I want to centralise the prices on our website, so that I can simply update one place, and once updated it propagates to all pages. I don't want to use a plugin. The idea I have is to create an array ...
1vote
1answer
602views
Create shortcodes within foreach loop (using array)
I have a custom theme that includes several template parts. I intend to use theme template parts within theme files as well as using them as shortcodes. To create the shortcodes I am currently ...
0votes
0answers
160views
How to utilise multiple values from a single shortcode attribute?
i.e [test somevalues=1,2,3,4,5] First time poster and alsoa php newb, I'm trying to add a feature to a plugin but I seem to keep triggering a debug notice from wordpress. $somearray = shortcode_atts([...
0votes
1answer
148views
WP Query by 4 different taxonomies
I need to make a shortcode that uses the values of four different taxonomies. I am trying to modify code that I have used to query attachments (in media) based off of multiple taxonomy terms, but ...
0votes
0answers
45views
How to use multiple (or array) values in $content of shortcode?
I have a shortcode that fetches some values, first_name, last_name and email from a remote database. I'm trying to write a shortcode that will allow me to print 2 or more of those values within output ...
1vote
2answers
4kviews
return an array with a shortcode
i have some fields, which i would like to print out with an shortcode with one attribute. i have normal variables and arrays, with my code only the first value of an array is printed... should i use ...
0votes
1answer
399views
How can i iterate through this shortcode array?
This is how $attr is created: $attr = shortcode_atts( array( 'chart' => null, 'footer_caption' => null, ), $attr, $shortcode_tag ); This is the print_r of $attr in this post ...
2votes
0answers
5kviews
Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
I've been trying to create a simple shortcode function so I could display in the frontend of my website a list of available Shipping Zones along with their most reliable information such as the zone ...
0votes
1answer
117views
Plugin Shortcode value in post
Theme was output with function get_post_meta(get_the_ID(), 'some_value', true); when I try with die(print_r()); function there have some array containing values such as [item_ticket_tailor] => ...
-1votes
1answer
77views
trouble with passing class method data to outside function
I'm attempting to call a function using this shortcode format: [priceguide file='test.csv' type='mods'] When I do this, all I get back on the page is the file name, test.csv, and nothing else. The ...
0votes
1answer
753views
Trying to get property of non-object in shortocde
I'm having error in shortcode that "Trying to get property of non-object" on line no 130 Here is code: while ( $our_work->have_posts() ) { $our_work->the_post(); $termsArray = ...
0votes
1answer
85views
Render shortcodes with get_post_custom
Wondering if anyone knows how to get a toggle shortcode to render when using: get_post_custom <?php $post_customs = get_post_custom(); //$post_customs = the_sub_field('project_items'); ...
4votes
1answer
579views
Autogenerate wordpress shortcodes using array?
I was create a shortcode which automatically generate shortcodes with given array key and value. Function names does not generate dynamically. Note: Array KEY = ShortcodeName and Value = Wordpress ...
0votes
1answer
2kviews
How to get specific string in explode array?
I have a shortcode where I'm trying to get a specific string from the $args array below. Query: $args = array( //'post_type' => $posttype, 'post_type' => explode( ', ', $posttype ), ); ...
0votes
1answer
2kviews
Pass a comma separated shortcode attribute to a function
I've been trying to create a shortcode for the Category Ajax Chain Selects plugin so that I can display the chain selects within a chosen post/page easily, but for now I've only been able to hardcode ...